From 49802797ebe9bf6591eba2e93895dd8efe0c7c4e Mon Sep 17 00:00:00 2001 From: "iap10@striker.cl.cam.ac.uk" Date: Thu, 11 Dec 2003 18:49:45 +0000 Subject: [PATCH] bitkeeper revision 1.647 (3fd8bc49qQxDHkfovcYSBfQ4p0Fpfg) Add Mark Williamson's readxenconsolering.py example script which reads Xen's console out of the buffer ring, making Xen's boot messages available from within domain 0. --- .rootkeys | 1 + tools/examples/readxenconsolering.py | 48 ++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 tools/examples/readxenconsolering.py diff --git a/.rootkeys b/.rootkeys index 27db4968aa..3686d6eb20 100644 --- a/.rootkeys +++ b/.rootkeys @@ -44,6 +44,7 @@ 3fbe2f12ltvweb13kBSsxqzZDAq4sg tools/examples/listdoms.py 3fca7788tBihusQSq3HJI-YKQTN2iQ tools/examples/mynewdom.py 3fca7700PVj36cZObaFZlQicRiw1pQ tools/examples/pincpu.py +3fd8bc48ww3aOqPhYjCr8KGulG0NQQ tools/examples/readxenconsolering.py 3fccbe068ov0YCxnk-2m4law19QMmA tools/examples/startdom.py 3fbe2f12Bnt8mwmr1ZCP6HWGS6yvYw tools/examples/stopdom.py 3f776bd2Xd-dUcPKlPN2vG89VGtfvQ tools/misc/Makefile diff --git a/tools/examples/readxenconsolering.py b/tools/examples/readxenconsolering.py new file mode 100644 index 0000000000..0e9305a1f3 --- /dev/null +++ b/tools/examples/readxenconsolering.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python + +# Copyright (C) 2003 by Intel Research Cambridge + +# File: tools/examples/readconsolering.py +# Author: Mark A Williamson (mark.a.williamson@intel.com) +# Date: 2003-12-02 + +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + + +"""Reads out the contents of the console ring + +Usage: readconsolering.py [-c] +The -c option causes the contents to be cleared. +""" + +import sys, Xc # import the Xc Xen Control module + +xc = Xc.new() # get a new instance of the control interface + +clear_buffer = False + +if sys.argv[1:] != []: + if sys.argv[1] == "-c": + clear_buffer = True + else: + print >> sys.stderr, "Usage: " + sys.argv[0] + """ [-c] + Reads the contents of the console buffer. + (specifying -c will also clear current contents)""" + +# Get the console ring's contents as a string and print it out. +# If argument to readconsolering is true then the buffer is cleared as well as +# fetching the (pre-clearing) contents. +print xc.readconsolering(clear_buffer) -- 2.30.2